home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / cserial / drop_dtr.c < prev    next >
C/C++ Source or Header  |  1990-04-04  |  1KB  |  53 lines

  1. /*
  2.  *                              DROP_DTR.C
  3.  *
  4.  *                           Written for the
  5.  *
  6.  *                              Datalight
  7.  *                           Microsoft V 5.x
  8.  *                                TurboC
  9.  *                                  &
  10.  *                               Zortech
  11.  *
  12.  *                             C Compilers
  13.  *
  14.  *            Copyright (c) John Birchfield 1987, 1988, 1989
  15.  */
  16. #include <stdlib.h>
  17. #include "dependnt.h"
  18. #include "timer.h"
  19. void dtnr (int);
  20.  
  21. main (int argc, char *argv [])
  22. {
  23.     if (argc > 1)
  24.         dtnr (atoi (argv [1]));
  25.     else
  26.         dtnr (1);
  27. }
  28.  
  29.  
  30.  
  31.  
  32. /*----------------------------- dtnr () -----------------------------*/
  33. /*
  34.  *
  35.  */
  36. # define MCR              4  /* modem control register */
  37. unsigned PORT_addr;
  38. char     MCR_save  = 0;
  39. void
  40. dtnr (int channel)
  41. {
  42.     int Dos_address;
  43.     unsigned i;
  44.     Dos_address = (channel - 1) * 2;
  45.     DELAY_init ();
  46.     peekmem (0x40, Dos_address, PORT_addr);
  47.     MCR_save = inbyte (PORT_addr+MCR);
  48.     outbyte (PORT_addr+MCR, 0);
  49.     DELAY_loop (1000);
  50.     outbyte (PORT_addr+MCR, MCR_save);
  51. }
  52.  
  53.